<?php

/**
 *
 * @author chedim
 *
 */
class Application
{
	private $appName;

	private $appDriver;

	/**
	 * @param $appName
	 * @return NULL
	 */
	function __construct($appName)
	{
		$this->appName = $appName;
	}

	/**
	 * @param $name
	 * @return XMLConvertable
	 */
	function state($name, $params = NULL)
	{
            $file = Styler::locate($this->appName.'.'.$name.'.php');
            if (!$file) {
                return new XMLException(QConst::X_STATE_NOT_FOUND);
            }

            $return = NULL;
            $code = file_get_contents($file);
            eval('?>'.$code.'<?');
            if (!(is_a($return, 'XMLConvertable'))) {
                    Log::fatal('XDYN element `'.$q['host'].'` located at <'.$file.'> must return object with XMLConvertable interface!.');
            }

            return $return;
	}

}

?>